<?php
namespace jy_liangoods;
defined('BY_JYA') or exit('error');
/*
	消息提醒
*/
class notice extends \plugin{
    public function gettpl_data($orderid,$type=0){//type=0表单订单，type=1
        return false;
    }
    /*
       新订单审核
   */
    public function notice_checkorder($log_id,$mid=''){
        //新订单审核
        $adminset=$this->plugin_setting('adminset');
        if(!$adminset['admins']){
            return false;
        }
        $order=pdo_get('jy_liangoods_sendlog',array('id'=>$log_id));
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['street'].''.$order['address'];
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$ordersn;
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【待审核】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/manage.worker_order/',true);
        }
        foreach($adminset['admins'] as $tv){
             if($tv['mid']){
				 //file_put_contents(ROOT_D.'/notice.txt',$tv['mid']."~notice_checkorder~\n",FILE_APPEND);
                 cfc('account')->sendtwoNotice($tv['mid'],$template_id,$message,$url,'checkorder','jy_liangoods',$log_id);
             }
        }
    }
	public function notice_nojieorder($adminset=array()){
        //30分钟未接单
        if(!$adminset['admins']){
            return false;
        }
        $order=pdo_get('jy_liangoods_sendlog',array('createtime <'=>time()-1800,'status'=>0,'uniacid'=>$_SESSION['uniacid']));
		if(!$order['id']){
            return false;
        }
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['street'].''.$order['address'];
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$ordersn;
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【有订单30分钟未接单】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/manage.worker_order/',true);
        }
        foreach($adminset['admins'] as $tv){
             if($tv['mid']){
				 //file_put_contents(ROOT_D.'/notice.txt',$tv['mid']."~notice_checkorder~\n",FILE_APPEND);
                 cfc('account')->sendtwoNotice($tv['mid'],$template_id,$message,$url,'checkorder','jy_liangoods',$log_id);
             }
        }
    }
	public function notice_no2order($adminset=array()){
        //30分钟未接单
        if(!$adminset['admins']){
            return false;
        }
        $order=pdo_get('jy_liangoods_sendlog',array('gettime <'=>time()-1800,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		if(!$order['id']){
            return false;
        }
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['street'].''.$order['address'];
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$ordersn;
		$order['merchname']=pdo_getcolumn('jy_merch_user',array('id'=>$order['merchid'],'uniacid'=>$_SESSION['uniacid']),'merchname');
		$order['merchname']=$order['merchname']?:'';
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>$order['merchname'].'-【有订单30分钟未拣货】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
		$url=custom_url('jy_liangoods/merch.index/',true);
		$orderlist=pdo_getall('jy_liangoods_sendlog',array('merchid >'=>0,'gettime <'=>time()-1800,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		foreach($orderlist as $ov){
			$mid=pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$ov['merchid']),'mid');
			cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'checkorder','jy_liangoods');
		}
        $url=custom_url('jy_liangoods/manage.worker_order/',true);
        foreach($adminset['admins'] as $tv){
             if($tv['mid']){
				 //file_put_contents(ROOT_D.'/notice.txt',$tv['mid']."~notice_checkorder~\n",FILE_APPEND);
                 cfc('account')->sendtwoNotice($tv['mid'],$template_id,$message,$url,'checkorder','jy_liangoods');
             }
        }
    }
    /*
        新订单通知
    */
    public function notice_newget($log_id,$mid=''){
        //新配送任务通知给配送员
        $order=pdo_get('jy_liangoods_sendlog',array('id'=>$log_id,'uniacid'=>$_SESSION['uniacid']));
		if(!$order['id']){
			return false;
		}
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name']?cfc('tools')->substr($order['name'],0,1).'****':'无姓名';
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['province'].' '.$address['pcd']['city'].' '.$address['pcd']['district'].' ******';
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$order[''];
        $template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【待抢单】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/merch.peisong_order/',true);
        }
        $mid=$mid?:pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['merchid']),'mid');
		$workers=pdo_get('jy_merch_worker',array('type >'=>0,'mid <>'=>$mid,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$workers[]=array('mid'=>$mid);
		foreach($workers as $wv){
				//file_put_contents(ROOT_D.'/notice.txt',$mid."~notice_newget~\n",FILE_APPEND);
				$mid=$wv['mid'];
				if($mid){
					cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'newget','jy_liangoods',$log_id);
				}
		}
		$basic=$this->plugin_setting('basic');
		if($basic['is_newgetpint']){
			$order['merchid']=$order['merchid']?:pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$mid),'id');
			$this->model('printmsg')->newgetpint($order);
		}
		return true;
    }
	public function notice_storeorder($order,$mid=''){
        //新配送任务通知给配送员
		if(!$order['storeid']){
			return false;
		}
        $goods['title']=$order['goods'][0]['title'];
        //用户地址
        $address='客户自己到门店自提';
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【配送任务】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/merch.index/',true);
        }
        $mid=$mid?:pdo_getcolumn('jy_weishop_store',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['storeid']),'mid');
		if($mid){
			cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'storeorder','jy_liangoods',$order['id']);
		}
    }
	 /*
        审核通过
    */
    public function notice_status3($log_id,$mid=''){
        //新配送任务通知商户发货
        $order=pdo_get('jy_liangoods_sendlog',array('id'=>$log_id));
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['province'].' '.$address['pcd']['city'].' '.$address['pcd']['district'].' '.$address['pcd']['street'].' ******';
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$order[''];
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【待发货】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/merch.worker_order//status=3',true);
        }
        $mid=$mid?:pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['merchid']),'mid');
		$workers=pdo_get('jy_merch_worker',array('type >'=>0,'mid <>'=>$mid,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$workers[]=array('mid'=>$mid);
		foreach($workers as $wv){
				$mid=$wv['mid'];
				if($mid){
					cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'newget','jy_liangoods',$log_id);
				}
		}
		$basic=$this->plugin_setting('basic');
		if($basic['is_fapint']){
			$this->model('printmsg')->faorder($order);
		}
		return true;
    }
	 /*
        拣货审核失败
    */
    public function notice_status6($log_id,$mid=''){
        //新配送任务通知商户发货
        $order=pdo_get('jy_liangoods_sendlog',array('id'=>$log_id));
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['province'].' '.$address['pcd']['city'].' '.$address['pcd']['district'].' '.$address['pcd']['street'].' ******';
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$order[''];
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【审核失败】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/merch.peisong_order/',true);
        }
        $mid=$mid?:pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['merchid']),'mid');
		$workers=pdo_get('jy_merch_worker',array('type >'=>0,'mid <>'=>$mid,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$workers[]=array('mid'=>$mid);
		foreach($workers as $wv){
				$mid=$wv['mid'];
				//file_put_contents(ROOT_D.'/notice.txt',$mid."~notice_status6~\n",FILE_APPEND);
				if($mid){
					cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'newget','jy_liangoods',$log_id);
				}
		}
		$basic=$this->plugin_setting('basic');
		if($basic['is_failpint']){
			$this->model('printmsg')->failpint($order);
		}
		return true;
    }
	public function notice_cancelorder($order=array()){
        //取消订单
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name']?cfc('tools')->substr($order['name'],0,1).'****':'无姓名';
        $address['mobile']=$order['mobile'];
        $addressinfo=$address['pcd']['province'].' '.$address['pcd']['city'].' '.$address['pcd']['district'].' ******';
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$order[''];
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【已取消订单】'.$goods['title'],"name" => "thing8"),
			array('value'=>$addressinfo.' '.$address['name'],"name" => "thing5"),
		);
        if(!$url){
            $url=custom_url('jy_liangoods/merch.worker_order/',true);
        }
        $mid=$mid?:pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['merchid']),'mid');
		$workers=pdo_get('jy_merch_worker',array('type >'=>0,'mid <>'=>$mid,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$workers[]=array('mid'=>$mid);
		foreach($workers as $wv){
				//file_put_contents(ROOT_D.'/notice.txt',$mid."~notice_newget~\n",FILE_APPEND);
				$mid=$wv['mid'];
				if($mid){
					cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'cancelorder','jy_liangoods',$order_id);
				}
		}
		$basic=$this->plugin_setting('basic');
		if($basic['is_delpint']){
			$this->model('printmsg')->delpint($order);
		}
		return true;
    }
    /*
        配送员新任务通知
    */
    public function notice_orderget($log_id,$url=''){
        //新配送任务通知给配送员
        $order=pdo_get('jy_liangoods_sendlog',array('id'=>$log_id));
		$order['createtime']=$order['createtime']?:time();
        $goods=json_decode($order['goods'],true);
        $goods['title']=$goods[0]['title'];
        //用户地址
        $address['pcd']=json_decode($order['pcd'],true);
        $address['name']=$order['name'];
        $address['mobile']=$order['mobile'];
        $address=$address['pcd']['province'].' '.$address['pcd']['city'].' '.$address['pcd']['district'].' '.$address['pcd']['street'].''.$order['address'];
        $ordersn=pdo_getcolumn('jy_weishop_order',array('id'=>$order['order_id'],'uniacid'=>$_SESSION['uniacid']),'ordersn');
        $order['ordersn']=$order[''];
		$template_id=cfc('account')->get_tpl_template_id('48089','收到客户新订单通知','',array('订单时间','商品名称','客户地址'));
        if($_SESSION['wxapp_id']){
            $wxapptemplate_id=cfc('wxapp_api')->get_tpl_template_id('17468',[1,2,3,7],'orderget','新配送任务通知','jy_liangoods');
        }
        $message=array(
			array('value'=>date('Y/m/d H:i:s',$order['createtime']),"name" => "time2"),
			array('value'=>'【待配送】'.$goods['title'],"name" => "thing8"),
			array('value'=>$address,"name" => "thing5"),
		);
        $wxappmsg=array(
            array('value'=>$ordersn),
            array('value'=>date('Y/m/d H:i:s',$order['createtime'])),
            array('value'=>$goods['title']),
            array('value'=>$address),
        );
        if(!$url){
            $url=custom_url('jy_liangoods/merch.worker_order/',true);
        }
        $mid=pdo_getcolumn('jy_merch_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['merchid']),'mid');
		$workers=pdo_get('jy_merch_worker',array('type >'=>0,'mid <>'=>$mid,'status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$workers[]=array('mid'=>$mid);
		foreach($workers as $wv){
				$mid=$wv['mid'];
				//file_put_contents(ROOT_D.'/notice.txt',$mid."~notice_status3~\n",FILE_APPEND);
				if($mid){
					cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'orderget','jy_liangoods',$log_id);
				}
		}
        if($_SESSION['wxapp_id']){
            $url='/jy_liangoods/merch.worker_order/detail/index';
            cfc('wxapp_api')->checktplNotice($order['peisong_id'],$wxapptemplate_id,$wxappmsg,$url,'orderget','jy_liangoods',$log_id);
        }
		if($basic['is_neworderpint']){
			$this->model('printmsg')->neworder($order);
		}
    }
    public function notice_pei2buyer($sendlog,$url=''){
        //订单配送提醒
        $template_id=cfc('account')->get_tpl_template_id('50079','订单配送提醒','',array('订单号','配送时间','商品名称'));
        $wxapp_id=$sendlog['wxapp_id'];
        if(!$_SESSION['wxapp_id'] && !$wxapp_id){
            $wxapp_id=cfc('fans')->get_appid($sendlog['buymid'],1);
        }
        if($_SESSION['wxapp_id'] || $wxapp_id){
            $wxapptemplate_id=cfc('wxapp_api',$wxapp_id)->get_tpl_template_id('31339',[2,3],'pei2buyer','订单配送提醒','jy_weishop');
        }
        $sendlog['goodsinfo']='';
        $sendlog['goods']=json_decode($sendlog['goods'],true);
        foreach($sendlog['goods'] as &$gv){
            $gv['title']=cfc('tools')->substr($gv['title'],0,6);
            $sendlog['goodsinfo'] .=$gv['title'];
            if($gv['selespename']){
                $sendlog['goodsinfo'] .='['.$gv['selespename'].']';
            }
            if($gv['leititle']){
                $sendlog['goodsinfo'] .='['.$gv['leititle'].']';
            }
            $sendlog['goodsinfo'] .="(".$gv['num'].")；";
            $gv['unit']=pdo_getcolumn('jy_weishop_goods',array('id'=>$gv['goodsid'],'uniacid'=>$_SESSION['uniacid']),'unit');
        }
        $times=$sendlog['day'].' '.$sendlog['times'];
		$message=array(
			array('value'=>'SN'.$sendlog['id'],"name" => "character_string1"),
			array('value'=>$times,"name" => "time8"),
			array('value'=>$sendlog['goodsinfo'],"name" => "thing5"),
		);
        $wxappmsg=array(
            array('value'=>$times),
            array('value'=>$sendlog['goodsinfo']),
        );
        if(!$url){
            $url='jy_liangoods/member.index/';
        }
        $url=custom_url($url,true);
        cfc('account')->sendtwoNotice($sendlog['buymid'],$template_id,$message,$url,'pei2buyer','jy_weishop',$sendlog['id']);
        if($_SESSION['wxapp_id'] && $wxapptemplate_id){
            $url='/jy_liangoods/member/index/index';
            $template_id=cfc('wxapp_api',$wxapp_id)->checktplNotice($sendlog['buymid'],$wxapptemplate_id,$wxappmsg,$url,'pei2buyer','jy_weishop',$sendlog['id']);
        }
    }
    public function notice_receive2buyer($sendlog){
        //发送订单收货通知给买方
        $template_id=cfc('account')->get_tpl_template_id('42984','订单确认收货通知','',array('订单编号','商品名称','购买时间','发货时间'));
        $wxapp_id=$sendlog['wxapp_id'];
        if(!$_SESSION['wxapp_id'] && !$wxapp_id){
            $wxapp_id=cfc('fans')->get_appid($sendlog['buymid'],1);
        }
        if($_SESSION['wxapp_id'] || $wxapp_id){
            $wxapptemplate_id=cfc('wxapp_api')->get_tpl_template_id('31042',[1,2,4,10,7],'receive2buyer','订单确认收货通知','jy_weishop');
        }
        $sendlog['goodsinfo']='';
        $sendlog['goods']=json_decode($sendlog['goods'],true);
        foreach($sendlog['goods'] as &$gv){
            $gv['title']=cfc('tools')->substr($gv['title'],0,6);
            $sendlog['goodsinfo'] .=$gv['title'];
            if($gv['selespename']){
                $sendlog['goodsinfo'] .='['.$gv['selespename'].']';
            }
            if($gv['leititle']){
                $sendlog['goodsinfo'] .='['.$gv['leititle'].']';
            }
            $sendlog['goodsinfo'] .="(".$gv['num'].")；";
            $gv['unit']=pdo_getcolumn('jy_weishop_goods',array('id'=>$gv['goodsid'],'uniacid'=>$_SESSION['uniacid']),'unit');
        }
        $times=$sendlog['day'].' '.$sendlog['times'];
		$message=array(
			array('value'=>'SN'.$sendlog['id'],"name" => "character_string2"),
			array('value'=>$sendlog['goodsinfo'],"name" => "thing4"),
			array('value'=>date('Y-m-d H:i:s',$sendlog['createtime']),"name" => "time17"),
			array('value'=>date('Y-m-d H:i:s',$times),"name" => "time12"),
		);
        $wxappmsg=array(
            array('value'=>'SN'.$sendlog['id']),
            array('value'=>$sendlog['goodsinfo']),
            array('value'=>date('Y-m-d H:i:s',$sendlog['createtime'])),
            array('value'=>$times),
            array('value'=>date('Y-m-d H:i:s')),
        );
        $url=custom_url('jy_liangoods/member.index/',true);
        cfc('account')->sendtwoNotice($sendlog['buymid'],$template_id,$message,$url,'receive2buyer','jy_weishop');
        if($_SESSION['wxapp_id'] && $wxapptemplate_id){
            $url='/jy_liangoods/member/index/index';
            $template_id=cfc('wxapp_api',$wxapp_id)->checktplNotice($sendlog['buymid'],$wxapptemplate_id,$wxappmsg,$url,'receive2buyer','jy_weishop');
        }
    }
    public function notice_check_apply($apply,$url=''){
        //审核通过
        $member=$this->get('member',array('id'=>$apply['pid'],'uniacid'=>$_SESSION['uniacid']));
        $template_id=cfc('account')->get_tpl_template_id('OPENTM408250107','申请成功通知');
        $message=array(
            'first'=>array('value'=>'申请成为配送员，审核通过！',"color" => "#4a5077"),
            'keyword1'=>array('value'=>$member['title'],"color" => "#4a5077"),
            'keyword2'=>array('value'=>$member['mobile'],"color" => "#4a5077"),
            'remark'=>array('value'=>'感谢你的使用。',"color" => "#4a5077"),
        );
        if(!$url){
            $url=custom_url('jy_liangoods/index/',true);
        }
        cfc('account')->sendtwoNotice($member['mid'],$template_id,$message,$url,'check_apply','jy_liangoods');
    }
	public function notice_fenxiao_dakuan($mid,$fee=0,$msg=''){
		//打款通知
		$template_id=cfc('account')->check_tpl_template('OPENTM400492077','jy_merch','打款通知');
		$userinfo=pdo_get('core_members',array('id'=>$mid),array('fromuser','nickname'));
		$msg=$msg?:'您好,提现申请已打款成功！';
		$message=array(
			'first'=>array('value'=>$msg,"color" => "#4a5077"),
			'keyword1'=>array('title'=>'用户ID','value'=>$userinfo['nickname'],"color" => "#4a5077"),			
			'keyword3'=>array('title'=>'打款金额','value'=>$fee,"color" => "#4a5077"),
			'keyword2'=>array('title'=>'打款时间','value'=>date('Y/m/d H:i:s',time()),"color" => "#4a5077"),
			'remark'=>array('value'=>'感谢您的使用！！',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_liangoods/merch.index/',true);
		}
		cfc('account')->sendtwoNotice($mid,$template_id,$message,$url,'fenxiao_dakuan','jy_merch');
	}
}
